using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class ModalityAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public ModalityAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.User;
						tableVersionTypes[HL7Version.v231] = HL7TableType.User;
						tableVersionTypes[HL7Version.v24] = HL7TableType.User;
						tableVersionTypes[HL7Version.v25] = HL7TableType.User;
						tableVersionTypes[HL7Version.v251] = HL7TableType.User;
						tableVersionTypes[HL7Version.v26] = HL7TableType.User;
						tableVersionTypes[HL7Version.v27] = HL7TableType.User;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{"AS","BS","CD","CP","CR","CS","CT","DD","DG","DM","EC","ES","FA","FS","LP","LS","MA","MS","NM","OT","PT","RF","ST","TG","US","XA"};
						validVersionCodes[HL7Version.v231] = new string[]{"AS","BS","CD","CP","CR","CS","CT","DD","DG","DM","EC","ES","FA","FS","LP","LS","MA","MS","NM","OT","PT","RF","ST","TG","US","XA"};
						validVersionCodes[HL7Version.v24] = new string[]{"AS","BS","CD","CP","CR","CS","CT","DD","DG","DM","EC","ES","FA","FS","LP","LS","MA","MS","NM","OT","PT","RF","ST","TG","US","XA"};
						validVersionCodes[HL7Version.v25] = new string[]{"AS","BS","CD","CP","CR","CS","CT","DD","DG","DM","EC","ES","FA","FS","LP","LS","MA","MS","NM","OT","PT","RF","ST","TG","US","XA"};
						validVersionCodes[HL7Version.v251] = new string[]{"AS","BS","CD","CP","CR","CS","CT","DD","DG","DM","EC","ES","FA","FS","LP","LS","MA","MS","NM","OT","PT","RF","ST","TG","US","XA"};
						validVersionCodes[HL7Version.v26] = new string[]{"AS","BS","CD","CP","CR","CS","CT","DD","DG","DM","EC","ES","FA","FS","LP","LS","MA","MS","NM","OT","PT","RF","ST","TG","US","XA"};
						validVersionCodes[HL7Version.v27] = new string[]{"AS","BS","CD","CP","CR","CS","CT","DD","DG","DM","EC","ES","FA","FS","LP","LS","MA","MS","NM","OT","PT","RF","ST","TG","US","XA"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{"Angioscopy","Biomagnetic imaging","Color Flow Doppler","Colposcopy","Computed Radiography","Cystoscopy","Computed Tomography","Duplex Doppler","Diapanography","Digital microscopy","Echocardiography","Endoscopy","Fluorescein Angiography","Fundoscopy","Laparoscopy","Laser surface scan","Magnetic Resonance Angiography","Magnetic Resonance Spectroscopy","Nuclear medicine (radioisotope study)","Other","Positron Emission Tomography (PET)","RadioFluoroscopy","Single Photon Emission Computed Tomography (SPECT)","Thermography","Ultrasound","X-Ray Angiography"};
						validVersionDescriptions[HL7Version.v231] = new string[]{"Angioscopy","Biomagnetic imaging","Color flow doppler","Colposcopy","Computed radiography","Cystoscopy","Computed tomography","Duplex doppler","Diapanography","Digital microscopy","Echocardiography","Endoscopy","Fluorescein angiography","Fundoscopy","Laparoscopy","Laser surface scan","Magnetic resonance angiography","Magnetic resonance spectroscopy","Nuclear Medicine (radioisotope study)","Other","Positron emission tomography (PET)","Radio fluoroscopy","Single photon emission computed tomography (SPECT)","Thermography","Ultrasound","X-ray Angiography"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"Angioscopy","Biomagnetic imaging","Color flow Doppler","Colposcopy","Computed radiography","Cystoscopy","Computed tomography","Duplex Doppler","Diapanography","Digital microscopy","Echocardiography","Endoscopy","Fluorescein angiography","Fundoscopy","Laparoscopy","Laser surface scan","Magnetic resonance angiography","Magnetic resonance spectroscopy","Nuclear Medicine (radioisotope study)","Other","Positron emission tomography (PET)","Radio fluoroscopy","Single photon emission computed tomography (SPECT)","Thermography","Ultrasound","X-ray Angiography"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"Angioscopy","Biomagnetic imaging","Color flow Doppler","Colposcopy","Computed radiography","Cystoscopy","Computed tomography","Duplex Doppler","Diapanography","Digital microscopy","Echocardiography","Endoscopy","Fluorescein angiography","Fundoscopy","Laparoscopy","Laser surface scan","Magnetic resonance angiography","Magnetic resonance spectroscopy","Nuclear Medicine (radioisotope study)","Other","Positron emission tomography (PET)","Radio fluoroscopy","Single photon emission computed tomography (SPECT)","Thermography","Ultrasound","X-ray Angiography"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"Angioscopy","Biomagnetic imaging","Color flow Doppler","Colposcopy","Computed radiography","Cystoscopy","Computed tomography","Duplex Doppler","Diapanography","Digital microscopy","Echocardiography","Endoscopy","Fluorescein angiography","Fundoscopy","Laparoscopy","Laser surface scan","Magnetic resonance angiography","Magnetic resonance spectroscopy","Nuclear Medicine (radioisotope study)","Other","Positron emission tomography (PET)","Radio fluoroscopy","Single photon emission computed tomography (SPECT)","Thermography","Ultrasound","X-ray Angiography"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"Angioscopy","Biomagnetic imaging","Color flow Doppler","Colposcopy","Computed radiography","Cystoscopy","Computed tomography","Duplex Doppler","Diapanography","Digital microscopy","Echocardiography","Endoscopy","Fluorescein angiography","Fundoscopy","Laparoscopy","Laser surface scan","Magnetic resonance angiography","Magnetic resonance spectroscopy","Nuclear Medicine (radioisotope study)","Other","Positron emission tomography (PET)","Radio fluoroscopy","Single photon emission computed tomography (SPECT)","Thermography","Ultrasound","X-ray Angiography"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"Angioscopy","Biomagnetic imaging","Color flow Doppler","Colposcopy","Computed radiography","Cystoscopy","Computed tomography","Duplex Doppler","Diapanography","Digital microscopy","Echocardiography","Endoscopy","Fluorescein angiography","Fundoscopy","Laparoscopy","Laser surface scan","Magnetic resonance angiography","Magnetic resonance spectroscopy","Nuclear Medicine (radioisotope study)","Other","Positron emission tomography (PET)","Radio fluoroscopy","Single photon emission computed tomography (SPECT)","Thermography","Ultrasound","X-ray Angiography"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
